<?php
/**
 * Joomla! 1.5 component jhtraq
 *
 * @version $Id: view.html.php 2010-03-09 08:28:06 svn $
 * @author JHShop
 * @package Joomla
 * @subpackage jhtraq
 * @license GNU/GPL
 *
 * Traq type system for Joomla
 *
 * This component file was created using the Joomla Component Creator by Not Web Design
 * http://www.notwebdesign.com/joomla_component_creator/
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport( 'joomla.application.component.view');
class JhtraqViewSettings extends JView {
    function display($tpl = null) {
//    $model =& JhtraqHelper::getModel('jhtraq');
//    print_r($model);

        $task = JRequest::getCmd('task', 'index');
        $tpl = $this->$task();

        parent::display($tpl);
    }

    function index() {
        $model =& JhtraqHelper::getModel('jhtraq');
        $this->settings = $model->getConfig();
        //print_r($this->settings);

    }

    function save() {
        $model =& JhtraqHelper::getModel('jhtraq');
        $model->saveConfig($_POST['cfg']);
        $mainframe =& JFactory::getApplication();
        $mainframe->redirect("index.php?option=com_jhtraq&view=settings", JText::_('Settings Updated'));
    }

    function engines() {
        $engines = array();
        $path = JPATH_SITE . DS . 'components' . DS . 'com_jhtraq' . DS . 'extras' . DS . 'captcha' . DS;
        foreach (glob("$path*.php") as $filename) {
            $engines[basename($filename)] = ucfirst(str_replace('.php','',basename($filename)));

        }
        return $engines;

    }



}
?>